//
//  WithdrowFinishVC.swift
//  HengYouCai
//
//  Created by lwj on 2017/12/7.
//  Copyright © 2017年 lwj. All rights reserved.
//

import UIKit

class WithdrowFinishVC: BaseTableViewController {

    var moneyText :String?
    var bankText : String?
    var tips : String?

    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.navigationController?.navigationBar.shadowImage = UIImage()
        self.navigationController?.navigationBar.setBackgroundImage( UIImage(named: "whiteImg"), for: UIBarMetrics.default)

    }
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = Normal_458Color
        self.navigationItem.title = "提现结果"
        self.tableView.tableFooterView = self.headerView
        self.tableView.showsVerticalScrollIndicator = false
        self.moneyLab.text = moneyText
        self.bankLab.text = bankText
        self.detailLab.text = tips
        finishBtn.addTarget(self, action: #selector(finishPopVC), for: .touchUpInside)
    }


    
    lazy var headerView: UIView = {
        let temp = UIView(frame: CGRect(x: 0, y: 0, width: JCWSCREENW, height: JCWSCREENH-kJcwGetNavHeight()))
        temp.backgroundColor = UIColor.white
        
        let headerImg = UIImageView(image: UIImage(named: "cash_result"))
        temp.addSubview(headerImg)
        _ = headerImg.sd_layout()
            .topSpaceToView(temp,50)?
            .centerXEqualToView(temp)?
            .heightIs(145)?
            .widthIs(145)
        let topGrayView = UIView(frame: CGRect(x: 0, y: 0, width: JCWSCREENW, height: 7.5))
        topGrayView.backgroundColor = Normal_458Color
        temp.addSubview(topGrayView)
        let titleLab = UILabel()
        titleLab.text = "提现申请已提交"
        titleLab.textColor = Normal_666Color
        titleLab.font = Font_WL(19)
        titleLab.textAlignment = .center
        temp.addSubview(titleLab)
        _ = titleLab.sd_layout()
            .topSpaceToView(headerImg,12)?
            .rightSpaceToView(temp,15)?
            .leftSpaceToView(temp,15)?
            .heightIs(18)
        
        let contentView = UIView()
        contentView.backgroundColor = UIColor.white
        contentView.layer.shadowColor = ColorFromRGBHex_WL(0xcccccc).cgColor
        contentView.layer.shadowOpacity = 1
        contentView.layer.shadowOffset = CGSize(width: 0, height: 0)
        contentView.layer.cornerRadius = 10
        temp.addSubview(contentView)
        _ = contentView.sd_layout()
            .topSpaceToView(titleLab,33)?
            .leftSpaceToView(temp,15)?
            .rightSpaceToView(temp,15)?
            .heightIs(90)
        let lineView = UIView()
        lineView.backgroundColor = Normal_CCCColor
        contentView.addSubview(lineView)
        _ = lineView.sd_layout()
            .centerYEqualToView(contentView)?
            .leftSpaceToView(contentView,15)?
            .rightSpaceToView(contentView,15)?
            .heightIs(0.5)
        let moneyTitleLab = UILabel()
        moneyTitleLab.text = "提现金额"
        moneyTitleLab.textColor = Normal_333Color
        moneyTitleLab.font = Font_WL(14)
        moneyTitleLab.textAlignment = .left
        contentView.addSubview(moneyTitleLab)
        _ = moneyTitleLab.sd_layout()
            .leftSpaceToView(contentView,15)?
            .topSpaceToView(contentView,0)?
            .bottomSpaceToView(lineView,0)?
            .widthIs(80)
        contentView.addSubview(self.moneyLab)
        _ = self.moneyLab.sd_layout()
            .topSpaceToView(contentView,0)?
            .rightSpaceToView(contentView,15)?
            .bottomSpaceToView(lineView,0)?
            .leftSpaceToView(moneyTitleLab,0)
        let bankTitleLab = UILabel()
        bankTitleLab.text = "到账银行卡"
        bankTitleLab.textColor = Normal_333Color
        bankTitleLab.font = Font_WL(14)
        bankTitleLab.textAlignment = .left
        contentView.addSubview(bankTitleLab)
        _ = bankTitleLab.sd_layout()
            .leftSpaceToView(contentView,15)?
            .topSpaceToView(lineView,0)?
            .bottomSpaceToView(contentView,0)?
            .widthIs(80)
        contentView.addSubview(self.bankLab)
        _ = self.bankLab.sd_layout()
            .leftSpaceToView(bankTitleLab,0)?
            .topSpaceToView(lineView,0)?
            .bottomSpaceToView(contentView,0)?
            .rightSpaceToView(contentView,15)
        
        temp.addSubview(self.detailLab)
        _ = self.detailLab.sd_layout()
            .topSpaceToView(contentView,12)?
            .leftSpaceToView(temp,15)?
            .rightSpaceToView(temp,15)?
            .autoHeightRatio(0)
        self.detailLab.setMaxNumberOfLinesToShow(0)
        
        temp.addSubview(self.finishBtn)
        _ = self.finishBtn.sd_layout()
            .topSpaceToView(self.detailLab,12)?
            .leftSpaceToView(temp,15)?
            .rightSpaceToView(temp,15)?
            .heightIs(45)
        
        return temp
    }()

    /// 提现金额
    lazy var moneyLab: UILabel = {
        let temp = UILabel()
        temp.textColor = Normal_ThemeColor
        temp.textAlignment = .right
        temp.text = "0.00元"
        temp.font = Font_WL(13)
        return temp
    }()
    /// 提现银行卡
    lazy var bankLab: UILabel = {
        let temp = UILabel()
        temp.textColor = Normal_333Color
        temp.textAlignment = .right
        temp.text = "中国银行"
        temp.font = Font_WL(13)
        return temp
    }()
    /// 提现详情
    lazy var detailLab: UILabel = {
        let temp = UILabel()
        temp.textColor = Normal_999Color
        temp.textAlignment = .left
        temp.text = ""
        temp.font = Font_WL(11)
        return temp
    }()
    /// 提现完成按钮
    lazy var finishBtn: UIButton = {
        let temp = UIButton(type: UIButtonType.custom)
        temp.backgroundColor = Normal_ThemeColor
        temp.setTitle("完成", for: .normal)
        temp.setTitleColor(UIColor.white, for: .normal)
        temp.titleLabel?.font = Font_WL(15)
        temp.layer.cornerRadius = 5
//        temp.clipsToBounds = true
        return temp
    }()
    
    func finishPopVC() {
        self.navigationController?.popToRootViewController(animated: true)
    }
}


